﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace SFast.Framework
{
    public static class FrameworkExtensions
    {

        //public static IQueryable<TSource> In<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
        //{

        //    Expression<Func<TSource, bool>> a = o =>false ;

        //    return source.Where();
        //}

        public static Expression<Func<TSource, bool>> Add<TSource>(this Expression<Func<TSource, bool>> exp1, Expression<Func<TSource, bool>> exp2)
        {
            var invokedExpr = Expression.Invoke(exp2, exp2.Parameters.Cast<Expression>());
            return Expression.Lambda<Func<TSource, bool>>
                (Expression.Add(exp1.Body, invokedExpr), exp1.Parameters);
        }
    }
}
